package com.lichuang.dedao.city.entity;

import java.math.BigDecimal;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;

import java.io.Serializable;
import java.sql.Date;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;

import com.lichuang.dedao.city.fingnclient.UserFeignClient;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * <p>
 * 笔记
 * </p>
 *
 * @author wp
 * @since 2019-07-13
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value = "Note对象", description = "笔记")

public class Note implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "笔记id")
    @TableId(value = "note_id", type = IdType.AUTO)
    private Integer noteId;

    @ApiModelProperty(value = "用户id")
    private Integer userId;

    @ApiModelProperty(value = "笔记内容")
    private String content;

    @ApiModelProperty(value = "笔记/评论/分享 img")
    private String shareImg;

    @ApiModelProperty(value = "内容标题")
    private String headline;

    @ApiModelProperty(value = "当前章节名称")
    private String section;

    @ApiModelProperty(value = "0:私密  1:公开")
    private Integer noteStatus;

    @ApiModelProperty(value = "分享时间")
    private LocalDateTime shareTime;

    @ApiModelProperty(value = "是否课程")
    private Integer whetherCourse;

    @ApiModelProperty(value = "是否听书")
    private Integer whetherHear_book;

    @ApiModelProperty(value = "是否课程")
    private Integer whetherEBook;

    @ApiModelProperty(value = "转发note_id 非转发文章，默认为0")
    private Integer transpondId;

    @ApiModelProperty(value = "点赞数")
    private Integer likes;

    @ApiModelProperty(value = "与当前时间相差间隔")
    @TableField(exist = false)
    private String leadtime;

    @ApiModelProperty(value = "用户头像")
    @TableField(exist = false)
    private String userimg;

    @ApiModelProperty(value = "用户名称")
    @TableField(exist = false)
    private String username;


    @ApiModelProperty(value = "下一条笔记")
    @TableField(exist = false)
    private List<Note> nextNodes = new ArrayList<Note>();


//    /**
//     * 将单个node添加到链表中
//     * @param list
//     * @param node
//     * @return
//     */
//    public static boolean addNode(List<Note> list,Reply node){
//        for (Reply node1 : list) {   //循环添加
//            if (node1.getCommentId()==node.getCommentParentId()){   //判断留言的上一段是都是这条留言
//                node1.getNextNodes().add(node);   //是，添加，返回true;
//                System.out.println("添加了一个");
//                return true;
//            }else{     //否则递归继续判断
//                if (node1.getNextNodes().size()!=0)
//                    if (Reply.addNode(node1.getNextNodes(),node)){
//                        return true;
//                    }
//            }
//        }
//        return false;
//    }
//
//    @Autowired
//    static UserFeignClient userFeignClient;
//    /**
//     * 将查出来的lastId不为null的回复都添加到第一层Node集合中
//     * @param firstList
//     * @param thenList
//     * @return
//     */
//    public static List addAllNode(List<Reply> firstList,List thenList){
//        while (thenList.size()!=0){
//            int size = thenList.size();
//            for (int i = 0;i<size;i++){
//                if (Reply.addNode(firstList,new Reply((Comment) thenList.get(i)))){
//                    thenList.remove(i);
//                    i--;
//                    size--;
//                }
//            }
//        }
//        return firstList;
//    }
//
//    //打印
//    public static void show(List<Reply> list){
//        for (Reply node : list) {
//            System.out.println(node.getCommentUserId()+" 用户回复了你："+node.getCommentContent());
//            if (node.getNextNodes().size()!=0){
//                Reply.show(node.getNextNodes());
//            }
//        }
//    }

}
